#ifndef _SLP_IMAGE_H_
#define _SLP_IMAGE_H_

struct	SLPImageHeader
{
// version history:
// ID		Info						Name	
// 0x0001	First version				Allan

// constant
	static const unsigned int			MAGIC_HEADER = "SLiP";
	static const unsigned int			VERSION_HEADER = 0x0001;
	enum	IMAGE_FORMAT
	{
		FORMAT_RGBA8,					// 32bit with Alpha
		FORMAT_RGB8,					// 24bit without alpha. Not supported on Wii
		FORMAT_RGB565,					// 16bit without alpha.
		FORMAT_DCMP,					// DXTC compressed images
		FORMAT_P256,					// Palletized 256 color
		FORMAT_P16,						// Palletized 16 color
		FORMAT_C	
	};
	enum	FLAGS
	{
		FLAGS_WII_SWIZZLED				= 0x01 << 0	// is the image pre-swizzled for wii?		
	};
	// how big is the palette? Some image-types don't have any
	static unsigned int					GetPaletteSize(IMAGE_FORMAT Format)
	{
		switch (Format)
		{
			case FORMAT_RGBA8:
			case FORMAT_RGB8:					
			case FORMAT_RGB565:
			case FORMAT_DCMP:			return 0;			// no palette
			case FORMAT_P256:			return 4 * 256;		// RGBA for each 256 color
			case FORMAT_P16:			return 4 * 16;		// RGBA for each 16 color
		}
		return 0;
	}
	// What's the bit-per-pixel? Total image ssi
	static unsigned int					GetBPP(IMAGE_FORMAT Format)
	{
		switch (Format)
		{
			case FORMAT_RGBA8:
			case FORMAT_RGB8:					
			case FORMAT_RGB565:
			case FORMAT_DCMP:			return 0;			// no palette
			case FORMAT_P256:			return 4 * 256;		// RGBA for each 256 color
			case FORMAT_P16:			return 4 * 16;		// RGBA for each 16 color
		}
		return 0;
	}
	unsigned int						Magic;
	unsigned int						Version;
	IMAGE_FORMAT						Format;
	unsigned int						Flags;
	unsigned int						Width;
	unsigned int						Height;
};

/////////////////////////////////////
// File format's pretty simple, and optimized for console loading.
// HEADER (make sure to check magic# and version#
// PALETTE (GetPaletteSize(IMAGE_FORMAT Format), can be 0 for non palettized images)
// PIXELS (Width * Height * 
//
// Makes a bunch of assumptions; the tool should be able to handle a larger set robustly.
// * All images have width and height as Pow2 (tool should expand it if doesn't)
// * All images are uncompressed (the VFS has ZLIB compression anyways
// * This is a final optimization step, so some images will have platform specific optimization


#endif //_SLP_IMAGE_H_